export default {
    namespaced: true,
    actions: {
        jiaOdd(context, value) {
            console.log("jiaOdd")
            context.dispatch("demo1", value)
            if (context.state.sum % 2) {
                context.commit("JIA", value)
            }
        },
        jiaWait(context, value) {
            setTimeout(() => {
                context.commit("JIA", value)
            }, 1000)
        },
        demo1(context, value) {
            console.log("demo1")
        }
    },
    mutations: {
        JIA(state, value) {
            //console.log("@",state,value)
            state.sum += value
        },
        JIAN(state, value) {
            state.sum -= value
        }
    },
    state: {
        sum: 0,//当前的和
        school: "宿舍",
        subject: 'vue',
    },
    getters: {
        bigSum(state) {
            return state.sum * 10
        }
    }
}